package com.Maykk.Demo01;

/**
 * @ClassName InnerClass
 * @Description: TODO 成员内部类
 * @Author: MaykkSTAR@163.com
 * @DATE: 2023/3/15
 */
public class InnerClass {
    private final String outStr = "我是外部类的成员属性";

    public static void main(String[] args) {
        InnerClass innerClass = new InnerClass();
        innerClass.runMethod();
    }

    private void outMethod() {
        System.out.println("我是外部类的方法~");
    }

    public void runMethod() {
        innerClass innerClass = new innerClass();
        System.out.println(innerClass.innerStr);
        innerClass.innerMethod();
        innerClass.runOutMethod();
    }

    public class innerClass {
        public final String innerStr = "我是内部类的成员属性";

        public void innerMethod() {
            System.out.println("我是内部类的成员方法");
        }

        public void runOutMethod() {
            System.out.println("内部类成员方法调用外部属性   " + outStr);
            outMethod();
        }
    }
}
